import request from '@/config/axios'

export interface shortLinkDetailVO {
  id: number
  name: string
  status: number
  createTime: Date
  domain: string
  type: number
}

export interface UpdateStatusReqVO {
  id: number
  status: number
}

// 创建客服链接配置
export const createShortLinkDetail = async (data) => {
  return await request.post({
    url: '/promotion/short-link-detail/create',
    data: data
  })
}

// 更新客服链接配置
export const updateShortLinkDetail = async (data) => {
  return await request.put({
    url: '/promotion/short-link-detail/update',
    data: data
  })
}

// 删除客服链接配置
export const deleteShortLinkDetail = async (id) => {
  return request.get({
    url: '/promotion/short-link-detail/delete?id=' + id,
    method: 'delete'
  })
}

// 删除客服链接配置
export const deleteShortLinkDetailList = async (id) => {
  return request.get({
    url: '/promotion/short-link-detail/deleteList?shortLinkId=' + id,
    method: 'delete'
  })
}

// 获得客服链接配置
export const getShortLinkDetail = async (id) => {
  return request.get({
    url: '/promotion/short-link-detail/get?id=' + id,
    method: 'get'
  })
}

// 获得客服链接配置分页
export const getShortLinkDetailPage = async (query) => {
  return request.get({
    url: '/promotion/short-link-detail/page',
    method: 'get',
    params: query
  })
}

// 导出客服链接配置 Excel
export const exportShortLinkDetailExcel = async (query) => {
  return request.download({
    url: '/promotion/short-link-detail/export-excel',
    params: query
  })
}

// 关闭链接
export const closeShortLinkDetail = async (id: number) => {
  return await request.put({ url: '/promotion/short-link-detail/close?id=' + id })
}
